﻿package {
    import flash.display.Sprite;
    import flash.net.LocalConnection;
    import flash.text.TextField;

    public class Reciever extends Sprite {
        private var conn:LocalConnection;
        private var output:TextField;
        
        public function Reciever()     {
            buildUI();
            
            conn = new LocalConnection();
            conn.client = this;
            try {
                conn.connect("myConnection");
            } catch (error:ArgumentError) {
                trace("Can't connect...the connection name is already being used by another SWF");
            }
        }
        
        public function lcHandler(msg:String):void {
            output.appendText(msg + "\n");
        }
        
        private function buildUI():void {
            output = new TextField();
			output.width = 790;
			output.height = 590;
			output.x = 5;
			output.y = 5;
            output.background = true;
            output.border = true;
            output.wordWrap = true;
            addChild(output);
        }
    }
}